package com.yaolifei.flower.web.socket;

import javax.servlet.http.HttpServletRequest;

import org.apache.catalina.websocket.StreamInbound;
import org.apache.catalina.websocket.WebSocketServlet;

public class MessageSocketServlet extends WebSocketServlet {

	private static final long serialVersionUID = -4825915240243546288L;
	
	@Override
	protected StreamInbound createWebSocketInbound(String subProtocol, HttpServletRequest request) {
		// return new MessageMessageInbound();
		return null;
	}
	
//	private class MessageMessageInbound extends MessageInbound {
//		@Override
//		protected void onBinaryMessage(ByteBuffer bb) throws IOException {
//			getWsOutbound().writeBinaryMessage(bb);
//		}
//
//		@Override
//		protected void onTextMessage(CharBuffer cb) throws IOException {
//			System.out.println(ClientConnection.getClients().size());
//			for (StreamInbound si : ClientConnection.getClients()) {
//				si.getWsOutbound().writeTextMessage(CharBuffer.wrap("aa" + cb));
//			}
//		}
//
//		@Override
//		protected void onOpen(WsOutbound outbound) {
//			System.out.println(this);
//			ClientConnection.getClients().add(this);
//		}
//
//		@Override
//		protected void onClose(int status) {
//			ClientConnection.getClients().remove(this);
//		}
//	}

}
